<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['数据管理','地磅数据下载']" icon="fa fa-download" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>地磅数据下载</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<div class="selectDate top_module">
									<div class="input-daterange input-group s_selected_time_box s_hover_box">
										<input type="text" [(ngModel)]='startTime' class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date()'>x</div>
									</div>
								</div>
								<button type="button" class="btn btn-primary" (click)="search_data()">查询</button>
								<button type="button" class="btn btn-primary" (click)="export_totle()">导出</button>
								<button type="button" class="btn btn-primary" (click)="weightModal.show()">导入</button>
								<button type="button" class="btn btn-primary" (click)="get_data()">提取[矩阵]</button>
								<button type="button" class="btn btn-primary" (click)="add_data(editModal)">添加</button>
								<button type="button" class="btn btn-primary" (click)="del_data()">删除</button>
								<button type="button" class="btn btn-primary" (click)="get_XN_data()">提取[梵途]</button>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<!--<th style="width: 55px;"><input type="checkbox" (change)="selectFn()" /></th>-->
										<th>车牌号</th>
										<th>过磅称重时间</th>
										<th>载重量</th>
										<th>是否审核</th>
										<th>任务编号</th>
										<th>更新时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData; let i = index" [attr.data-index]="i" [ngClass]='{selected: activeSelected[i] === row.id }' (click)="selectedRow(row,$event,i)">
										<!--<td><input type="checkbox" (change)="onCheckboxChangeFn(row.id)" /></td>-->
										<td>{{row.carNumber}}</td>
										<td>{{row.date}}</td>
										<td>{{row.weight}}</td>
										<td>
										  	<span  *ngIf="row.review" class="green">已审核</span>
					           				<span  *ngIf="!row.review" class="red">未审核</span>
										</td>
										<td>{{row.taskId}}</td>
										<td>{{row.uploadDate}}</td>
										<td>
											<button type="button" (click)="editRow(row,editModal,$event)" >编辑</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	
	<!-- 导入弹窗-->
	<div bsModal #weightModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="cancelUp(weightModal)" aria-label="Close">
	            <span aria-hidden="true">&times;</span>
	          </button>
					<h4 class="modal-title">上传Excel文件</h4>
				</div>
				<div class="modal-body">
	
					<div class="row">
						<form class="form form-inline " role="form">
							
							<div class="row" style="margin-bottom: 24px;">
								<div class="form-group module_line">
									<button type="button" class="btn btn-primary" (click)="load_module()">下载模板</button>
									<span class="row" class="note">注：请先下载模板，采用模板编辑文件后上传</span>
								</div>
							</div>
							
							
							<div class="row">
								<!--<label class="control-label col-sm-1" for="imgFile" style="padding: 0;display: inline-block;line-height: 32px;">文件</label>-->
								<div class="col-sm-10" style="padding: 0;">
									<div class="clearfix module_line">
										<button  type="button"  class="btn btn-primary" style="width: 120px;">上传模板文件
											<input type="file" class="up" (change)="fileChange($event.target.files)" name="fileToUpload" (click)='clearFile()' [(ngModel)]='fileUp'  type="file"  placeholder=''/>
										</button>
										<span class="row" class="note">注：格式excel</span>
									</div>
								</div>
							</div>
							<div *ngIf="fileToUpload">
								<label class="control-label col-sm-1" ></label>
								<div>
									<ul>
										<li class="file_list"><i class="fa fa-file-text-o" style="margin-right: 12px;"></i>{{fileToUpload.name}}<i class="fa fa-check-circle green" style="margin-left: 60px;"></i></li>
									</ul>
								</div>
							</div>
						</form>
					</div>
	
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelUp(weightModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="submitData(weightModal)">确认</button>
				</div>
			</div>
		</div>
	</div>
	
	
</div>
<!--编辑行表格弹窗-->
<section bsModal #editModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-lg">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" aria-label="Close" (click)="cancelEdit(editModal)"><span aria-hidden="true">&times;</span></button>     
				<h4 class="modal-title">{{handleTitle}}地磅数据</h4>
			</div>
			<div class="modal-body">
				<form class="form-horizontal " name="rowDataForm" id="rowDataForm" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
					<div class="form-group">
						<label class="control-label col-sm-2 no-padding-right">车牌号码<sup>*</sup></label>
						<div class="col-sm-9">
							<div class="clearfix">
								<input class="form-control" name="carNumber" [(ngModel)]="handleRow.carNumber" placeholder="车牌号码" type="text" />
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2 no-padding-right">过磅时间<sup>*</sup></label>
						<div class="col-sm-9">
							<div class="clearfix">
								<input class="form-control" name="uploadDate" id="uploadDate" autocomplete="off" [(ngModel)]='handleRow.date' type="text" placeholder="请选择过磅时间" />
								<!-- <input class="form-control" name="uploadDate"  [(ngModel)]="handleRow.date" placeholder="过磅称重时间" type="text" /> -->
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2 no-padding-right">载重量[吨]</label>
						<div class="col-sm-9">
							<div class="clearfix">
								<input class="form-control" name="weight"  [(ngModel)]="handleRow.weight" placeholder="载重量" type="text" />
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2 no-padding-right">是否审核</label>
						<div class="col-sm-9">
							<div class="clearfix">
								<select name="review" class="form-control"  [(ngModel)]="handleRow.review">
									<option value="">请选择</option>
									<option value="true">是</option>
									<option value="false">否</option>
								</select>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="control-label col-sm-2 no-padding-right">任务编号</label>
						<div class="col-sm-9">
							<div class="clearfix">
								<input class="form-control" name="taskId" placeholder="任务编号" type="text"  [(ngModel)]="handleRow.taskId" />
							</div>
						</div>
					</div>
				</form>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-default" (click)="cancelEdit(editModal)">取消</button>
				<button type="button" class="btn btn-primary" (click)="editSubmit(editModal)">确认</button>
			</div>
		</div>
	</div>
</section>
<!--编辑行表格弹窗 弹窗-->
